Data Preparing:

#Use datatable to show the first 100 cases

Visualize the crime

Preprocessing

library(tidyverse)
library("lubridate")

clean_total <- clean_total %>%
  mutate(Date = as.Date(Date.Rptd, "%m/%d/%Y %H:%M:%S")) %>%
  mutate(Location = str_squish(LOCATION))

names(clean_total)[names(clean_total) == 'Crm.Cd.Desc'] <- "Category"
clean_total$Year <- format(clean_total$Date, format="%Y")

Map

Crime over space

To visualize the data, we created an interactive map using the booklet to help us visualize the distribution of crime incidents in Los Angeles. The map contains 43,831 total crime data. The pop-up provides information on the category, date, address, victim’s age, victim’s gender, longitude and latitude. The purpose of this interactive map is to help us display more detailed information based on location.

Crime over time

Overall trend

The crime graph over time shows us the general trend in the number of daily crimes in Los Angeles. Based on the map, we can see that as of July 2021, Los Angeles has an annual daily crime count of around 60. In the first few months of the pandemic, crime numbers fell sharply compared to the end of 2021. Specifically, the daily crime rate dropped by nearly 78%.

In category

Here, I break down the crime categories into battery, burglary, intimate partner, robbery, and criminal threat. As the plot shows, we conclude that the number of burglaries and robberies has decreased significantly due to the pandemic, but the number of intimate partner crimes has increased dramatically.

Aggregte data

Summarize the data by crime category, and calculate the percentage of each crime.

## [1] "C"

These are the top six categories of crime. And assaults are classified into two types: simple assault and aggravated assault. A simple assault is defined as any purposeful conduct that puts another person in reasonable fear of being battered. Aggravated assault includes more serious crimes, such as assault with the intent to cause significant bodily harm or assault with a lethal weapon, such as a firearm.

Create a bar plot based on the crime category.

We can clearly observe that simple assault from intimate partner has the highest frequency number of nearly 15,000 and counts for 33% of the whole crime types. And its aggravated assault has the third highest frequency. Intimate partner violence is defined as abuse or aggressiveness in a romantic relationship. And battery has the second highest number of over 12,000 and counts for 27%. In criminal law, this is a physical act that results in damaging or offensive contact with another person without that person’s agreement.

And we also create a pie chart to show percentage of each categories more straightforward.

Through these statistics, we can conclude that assault from intimate partners has the highest frequency in Los Angeles during 2020 to 2022. Many risk factors can lead to intimate partner violence, such as people who have a low self-esteem, low education or income, and unstable emotions. For relationship factors, unhealthy family relationships, strong dominance and control by the partner, etc. And people who are in the communities with easy access to drugs and alcohol are more likely to be involved in this crime.

Correlation analysis

Crime By Category

By Category

## By Category (Normalized)

## By Police District

By Month

By Year